package com.gee.solon.web.mgt.controller;

import com.gee.solon.web.mgt.entity.UserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Get;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.Result;

import java.time.LocalDateTime;

/**
 * @author gepengjun
 * @since 2024/3/12 15:51
 */
@Api("用户信息")
@Controller
@Mapping("/userInfo")
public class UserInfoController {

    @ApiOperation(value = "根据id获取单个用户信息")
    @Get
    @Mapping("/getById/{id}")
    public Result<UserInfo> getById(Integer id){
        System.out.println(id);
        UserInfo userInfo = new UserInfo();
        userInfo.setUserId(id.longValue());
        userInfo.setUserName("aa" + id);
        userInfo.setAge(20 + id);
        userInfo.setBirthday(LocalDateTime.now());
        return Result.succeed(userInfo);
    }
}
